home *** CD-ROM | disk | FTP | other *** search
/ FishMarket 1.0 / FishMarket v1.0.iso / fishies / 201-225 / disk_222 / plplot / src / source.zoo / plstyl.c < prev    next >
C/C++ Source or Header  |  1989-05-15  |  1KB  |  51 lines

  1. /* Set up a new line style of "nels" elements, with mark and space */
  2. /* lengths given by arrays "mk" and "sp". */
  3.  
  4. #include "plplot.h"
  5. #include "declare.h"
  6.  
  7. void plstyl(nels,mk,sp)
  8. int nels,mk[],sp[];
  9. {
  10.     int i;
  11.  
  12.     if ((nels < 0) || (nels > 10)) {
  13.       fatal("Broken lines cannot have <0 or >10 elements");
  14.     }
  15.  
  16.     nms = nels;
  17.     for (i=0; i<nels; i++) {
  18.         mark[i] = mk[i];
  19.         space[i] = sp[i];
  20.         if ((mk[i] < 0) || (sp[i] < 0))
  21.             fatal("Mark and space lengths must be > 0 in PLSTYL");
  22.     }
  23.  
  24.     curel = 0;
  25.     pendn = 1;
  26.     timecnt = 0;
  27.     alarm = mark[curel];
  28. }
  29.  
  30. /* Updates line style variables, called whenever alarm goes off */
  31.  
  32. void plupd()
  33. {
  34.     while ( timecnt >= alarm ) {
  35.         if (pendn != 0) {
  36.             pendn = 0;
  37.             timecnt = timecnt - alarm;
  38.             alarm = space[curel];
  39.         }
  40.         else {
  41.             pendn = 1;
  42.             timecnt = timecnt - alarm;
  43.             curel = curel + 1;
  44.             if (curel >= nms) curel = 0;
  45.             alarm = mark[curel];
  46.         }
  47.     }
  48. }
  49.  
  50.  
  51.